package com.water_work_form.config;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.water_work_form.entity.*;
import com.water_work_form.mapper.*;
import com.water_work_form.service.*;
import com.water_work_form.util.RandomIdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

@Configuration
public class ScheduledConfig {

    @Autowired
    BasicFormMapper basicFormMapper;

    @Autowired
    BasicDeviceMapper basicDeviceMapper;

    @Autowired
    BasicDrugMapper basicDrugMapper;

    @Autowired
    BasicRestrictionMapper basicRestrictionMapper;

    @Autowired
    BasicWaterMapper basicWaterMapper;

    @Autowired
    BasicPhDiluteMapper basicPhDiluteMapper;

    @Autowired
    BasicPhLiquidMapper basicPhLiquidMapper;

    @Autowired
    BasicPhMapper basicPhMapper;

    @Autowired
    BasicFormulaMapper basicFormulaMapper;

    @Autowired
    BasicVolumeMapper basicVolumeMapper;

    @Autowired
    BasicCurveMapper basicCurveMapper;

    @Autowired
    BasicCurvePreparationMapper basicCurvePreparationMapper;

    @Autowired
    RecordSynchronousComparisonMapper recordSynchronousComparisonMapper;

    @Autowired
    RecordProteinNitrogenDetectionMapper recordProteinNitrogenDetectionMapper;

    @Autowired
    RecordCoagulationService recordCoagulationService;

    @Autowired
    RecordDisinfectService recordDisinfectService;

    @Autowired
    RecordSynchronousComparisonService recordSynchronousComparisonService;

    @Autowired
    RecordProteinNitrogenDetectionService recordProteinNitrogenDetectionService;

    @Autowired
    RecordPotentialPhService recordPotentialPhService;

    @Autowired
    RecordCapacityAnalysisService recordCapacityAnalysisService;

    @Autowired
    RecordSpectrophotometricService recordSpectrophotometricService;

    /**
     * 表单每日定时(晚11点即23点)新增
     */

    @Scheduled(cron = "00 00 23 * * ?")
    @Async
    public void newTable() {

        /*
          记录——混凝实验原始记录 定时添加(默认数据：id:随机数，form：{name："混凝实验原始记录"}，front_deal_message："{}"，fecl3："{}"，pac："{}"，pam："{}"，turbidity："{}"，status=1(未完成))
         */
        RecordCoagulation recordCoagulation = new RecordCoagulation();
        recordCoagulation.setId(RandomIdUtil.createRandomId());
        recordCoagulation.setForm((basicFormMapper.getOneByName("混凝实验原始记录")).toString());
        recordCoagulation.setFrontDealMessage("{\"sodiumHypochlorite\":\"\",\"residualChlorine\":\"\"}");
        recordCoagulation.setFeCl3("{\"feCl1\":\"\",\"feCl2\":\"\",\"feCl3\":\"\",\"feCl4\":\"\",\"feCl5\":\"\",\"feCl6\":\"\"}");
        recordCoagulation.setPac("{\"pac1\":\"\",\"pac2\":\"\",\"pac3\":\"\",\"pac4\":\"\",\"pac5\":\"\",\"pac6\":\"\"}");
        recordCoagulation.setPam("{\"pam1\":\"\",\"pam2\":\"\",\"pam3\":\"\",\"pam4\":\"\",\"pam5\":\"\",\"pam6\":\"\"}");
        recordCoagulation.setTurbidity("{\"turbidity1\":\"\",\"turbidity2\":\"\",\"turbidity3\":\"\",\"turbidity4\":\"\",\"turbidity5\":\"\",\"turbidity6\":\"\"}");
        recordCoagulation.setStatus(1);
        recordCoagulationService.save(recordCoagulation);

        /*
          记录——消毒实验原始记录 定时添加(默认数据（基础表：{查询列：查询数据}）id:随机数，form：{name："消毒实验原始记录"}，device：{type："PCⅡ"}，drug{drugName："氨色列"}，
                                     restriction{restriction29：{name："集团出厂余氯指标"}，restriction30：{name："消毒实验目标指标"}}，chlorine_liquid_dosage_detail："{}"，
                                     residual_chlorine_detail："{}"，status=1(未完成))
         */
        RecordDisinfect recordDisinfect = new RecordDisinfect();
        recordDisinfect.setId(RandomIdUtil.createRandomId());
        recordDisinfect.setForm((basicFormMapper.getOneByName("消毒实验原始记录")).toString());
        recordDisinfect.setDevice((basicDeviceMapper.getOneByName("PCⅡ")).toString());
        recordDisinfect.setDrug((basicDrugMapper.getOneByName("氨色列")).toString());
        String restriction29 = basicRestrictionMapper.getOneByName("集团出厂余氯指标").toString();
        String restriction30 = basicRestrictionMapper.getOneByName("消毒实验目标指标").toString();
        recordDisinfect.setRestriction("{\"restriction29\":" + restriction29 + ",\"restriction30\":" + restriction30 + "}");
        recordDisinfect.setChlorineLiquidDosageDetail("{\"chlorineLiquidDosageDetail1\":\"\",\"chlorineLiquidDosageDetail2\":\"\",\"chlorineLiquidDosageDetail3\":\"\"," +
                "\"chlorineLiquidDosageDetail4\":\"\",\"chlorineLiquidDosageDetail5\":\"\",\"chlorineLiquidDosageDetail6\":\"\",\"chlorineLiquidDosageDetail7\":\"\"," +
                "\"chlorineLiquidDosageDetail8\":\"\",\"chlorineLiquidDosageDetail9\":\"\",\"chlorineLiquidDosageDetail10\":\"\",\"chlorineLiquidDosageDetail11\":\"\"," +
                "\"chlorineLiquidDosageDetail12\":\"\"}");
        recordDisinfect.setResidualChlorineDetail("{\"residualChlorineDetail1\":\"\",\"residualChlorineDetail2\":\"\",\"residualChlorineDetail3\":\"\",\"residualChlorineDetail4\":\"\"," +
                "\"residualChlorineDetail5\":\"\",\"residualChlorineDetail6\":\"\",\"residualChlorineDetail7\":\"\",\"residualChlorineDetail8\":\"\",\"residualChlorineDetail9\":\"\"," +
                "\"residualChlorineDetail10\":\"\",\"residualChlorineDetail11\":\"\",\"residualChlorineDetail12\":\"\"}");
        recordDisinfect.setStatus(1);
        recordDisinfectService.save(recordDisinfect);

        /*
          记录——津滨水厂同步比对原始记录 定时添加(默认数据：id:随机数，form：{name："津滨水厂同步比对原始记录"}，record_date:yyyy-MM-dd(当前日期date格式),status=1(未完成))
         */
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date currentTime = new Date();
        String currentFormattedTime = dateFormat.format(currentTime);
        QueryWrapper<RecordSynchronousComparison> queryWrapperSynchronousComparison = new QueryWrapper<>();
        queryWrapperSynchronousComparison.eq("record_date",currentFormattedTime);
        List<RecordSynchronousComparison> listSynchronousComparison = recordSynchronousComparisonMapper.selectList(queryWrapperSynchronousComparison);
        if (listSynchronousComparison == null || listSynchronousComparison.size() == 0){
            Date currentDate = new Date();
            try {
                currentDate = dateFormat.parse(currentFormattedTime);
            } catch (ParseException e) {
                e.printStackTrace();
            }
            RecordSynchronousComparison recordSynchronousComparison = new RecordSynchronousComparison();
            recordSynchronousComparison.setId(RandomIdUtil.createRandomId());
            recordSynchronousComparison.setForm((basicFormMapper.getOneByName("津滨水厂同步比对原始记录")).toString());
            recordSynchronousComparison.setRecordDate(currentDate);
            recordSynchronousComparison.setStatus(1);
            recordSynchronousComparisonService.save(recordSynchronousComparison);
        }else {
            System.out.println("当日记录已存在");
        }

        /*
          记录——蛋白性氮检测原始记录 定时添加(默认数据：id:随机数，form：{name："蛋白性氮检测原始记录"}，record_date:yyyy-MM-dd(当前日期date格式),status=1(未完成))
         */
        QueryWrapper<RecordProteinNitrogenDetection> queryWrapperProteinNitrogenDetection = new QueryWrapper<>();
        queryWrapperProteinNitrogenDetection.eq("record_date",currentFormattedTime);
        List<RecordProteinNitrogenDetection> listProteinNitrogenDetection = recordProteinNitrogenDetectionMapper.selectList(queryWrapperProteinNitrogenDetection);
        if (listProteinNitrogenDetection == null || listProteinNitrogenDetection.size() == 0){
            Date currentDate = new Date();
            try {
                currentDate = dateFormat.parse(currentFormattedTime);
            } catch (ParseException e) {
                e.printStackTrace();
            }
            RecordProteinNitrogenDetection recordProteinNitrogenDetection = new RecordProteinNitrogenDetection();
            recordProteinNitrogenDetection.setId(RandomIdUtil.createRandomId());
            recordProteinNitrogenDetection.setForm((basicFormMapper.getOneByName("蛋白性氮检测原始记录")).toString());
            recordProteinNitrogenDetection.setRecordDate(currentDate);
            recordProteinNitrogenDetection.setStatus(1);
            recordProteinNitrogenDetectionService.save(recordProteinNitrogenDetection);
        }else {
            System.out.println("当日记录已存在");
        }

        /*
          记录——电位法检测pH原始记录 定时添加(默认数据（基础表：{查询列：查询数据}）id:随机数，form：{name："电位法检测pH原始记录"}，device：{type："Seven Excellence"}，restriction{name："pH"}，
              water:{id:"1695181972982825"},ph_dilute:{diluteNo:"GSB0731592014"},ph_liquid:{liquid1:{batch_number:"1H137J"},liquid2:{batch_number:"1H080A"},liquid3:{batch_number:"1H004A"}},
              check_value："{}"，raw_water："{}"，tap_water："{}"，status=1(未完成))
         */
        RecordPotentialPh recordPotentialPh = new RecordPotentialPh();
        recordPotentialPh.setId(RandomIdUtil.createRandomId());
        recordPotentialPh.setForm((basicFormMapper.getOneByName("电位法检测pH原始记录")).toString());
        recordPotentialPh.setDevice((basicDeviceMapper.getOneByName("Seven Excellence")).toString());
        recordPotentialPh.setRestriction((basicRestrictionMapper.getOneByName("pH")).toString());
        recordPotentialPh.setWater((basicWaterMapper.getOneByName("1695181972982825")).toString());
        recordPotentialPh.setPhDilute((basicPhDiluteMapper.getOneByName("GSB0731592014")).toString());
        String liquidPotentialPh1 = basicPhLiquidMapper.getOneByName("1H137J").toString();
        String liquidPotentialPh2 = basicPhLiquidMapper.getOneByName("1H080A").toString();
        String liquidPotentialPh3 = basicPhLiquidMapper.getOneByName("1H004A").toString();
        recordPotentialPh.setPhLiquid("{\"liquid1\":" + liquidPotentialPh1 + ",\"liquid2\":" + liquidPotentialPh2 + ",\"liquid3\":" + liquidPotentialPh3 + "}");
        recordPotentialPh.setCheckValue("{\"readingOne\":\"\",\"readingTwo\":\"\",\"averageValue\":\"\",\"measuringTemperature\":\"\"}");
        recordPotentialPh.setRawWater("{\"sampleTemperature\":\"\",\"readingOne\":\"\",\"readingTwo\":\"\",\"averageValue\":\"\"}");
        recordPotentialPh.setTapWater("{\"sampleTemperature\":\"\",\"readingOne\":\"\",\"readingTwo\":\"\",\"averageValue\":\"\"}");
        recordPotentialPh.setStatus(1);
        recordPotentialPhService.save(recordPotentialPh);

        /*
          记录——容量分析（总硬度、总碱度、氯化物、高猛酸盐指数）原始记录 定时添加(默认数据（基础表：{查询列：查询数据}）id:随机数，form：{name："容量分析（总硬度、总碱度、氯化物、高锰酸盐指数）原始记录"}，device：[{type："BR4760161"}]，
              restriction{restriction1:{name:"高锰酸盐指数"},restriction2:{name:"总硬度"},restriction3:{name:"氯化物"},restriction4:{name:"总碱度"}}，drug{drug1:{name:"高锰酸盐指数"},drug2:{name:"总硬度"},drug3:{name:"氯化物"},drug4:{name:"总碱度"}}，
              ph{ph1:{name:"高锰酸盐指数"},ph2:{name:"总硬度"},ph3:{name:"氯化物"},ph4:{name:"总碱度"}}，formula{formula1:{name:"高锰酸盐指数"},formula2:{name:"总硬度"},formula3:{name:"氯化物"},formula4:{name:"总碱度"}}，
              volume{volume1:{name:"高锰酸盐指数"},volume2:{name:"总硬度"},volume3:{name:"氯化物"},volume4:{name:"总碱度"}},permanganate："{}"，hardness："{}"，chloride："{}"，
              alkalinity："{}"，status=1(未完成))
         */
        RecordCapacityAnalysis recordCapacityAnalysis = new RecordCapacityAnalysis();
        recordCapacityAnalysis.setId(RandomIdUtil.createRandomId());
        recordCapacityAnalysis.setForm((basicFormMapper.getOneByName("容量分析（总硬度、总碱度、氯化物、高锰酸盐指数）原始记录")).toString());
        recordCapacityAnalysis.setDevice((basicDeviceMapper.listByName("BR4760161")).toString());
        String restrictionCapacityAnalysis1 = basicRestrictionMapper.getOneByName("高锰酸盐指数").toString();
        String restrictionCapacityAnalysis2 = basicRestrictionMapper.getOneByName("总硬度").toString();
        String restrictionCapacityAnalysis3 = basicRestrictionMapper.getOneByName("氯化物").toString();
        String restrictionCapacityAnalysis4 = basicRestrictionMapper.getOneByName("总碱度").toString();
        recordCapacityAnalysis.setRestriction("{\"restriction1\":" + restrictionCapacityAnalysis1 + ",\"restriction2\":" + restrictionCapacityAnalysis2 + ",\"restriction3\":" + restrictionCapacityAnalysis3 + ",\"restriction4\":" + restrictionCapacityAnalysis4 + "}");
        String drugCapacityAnalysis1 = basicDrugMapper.listByName("高锰酸盐指数").toString();
        String drugCapacityAnalysis2 = basicDrugMapper.listByName("总硬度").toString();
        String drugCapacityAnalysis3 = basicDrugMapper.listByName("氯化物").toString();
        String drugCapacityAnalysis4 = basicDrugMapper.listByName("总碱度").toString();
        recordCapacityAnalysis.setDrug("{\"drug1\":" + drugCapacityAnalysis1 + ",\"drug2\":" + drugCapacityAnalysis2 + ",\"drug3\":" + drugCapacityAnalysis3 + ",\"drug4\":" + drugCapacityAnalysis4 + "}");
        String phCapacityAnalysis1 = basicPhMapper.getOneByName("高锰酸盐指数").toString();
        String phCapacityAnalysis2 = basicPhMapper.getOneByName("总硬度").toString();
        String phCapacityAnalysis3 = basicPhMapper.getOneByName("氯化物").toString();
        String phCapacityAnalysis4 = basicPhMapper.getOneByName("总碱度").toString();
        recordCapacityAnalysis.setPh("{\"ph1\":" + phCapacityAnalysis1 + ",\"ph2\":" + phCapacityAnalysis2 + ",\"ph3\":" + phCapacityAnalysis3 + ",\"ph4\":" + phCapacityAnalysis4 + "}");
        String formulaCapacityAnalysis1 = basicFormulaMapper.getOneByName("高锰酸盐指数").toString();
        String formulaCapacityAnalysis2 = basicFormulaMapper.getOneByName("总硬度").toString();
        String formulaCapacityAnalysis3 = basicFormulaMapper.getOneByName("氯化物").toString();
        String formulaCapacityAnalysis4 = basicFormulaMapper.getOneByName("总碱度").toString();
        recordCapacityAnalysis.setFormula("{\"formula1\":" + formulaCapacityAnalysis1 + ",\"formula2\":" + formulaCapacityAnalysis2 + ",\"formula3\":" + formulaCapacityAnalysis3 + ",\"formula4\":" + formulaCapacityAnalysis4 + "}");
        String volumeCapacityAnalysis1 = basicVolumeMapper.getOneByName("高锰酸盐指数（样品体积mL）").toString();
        String volumeCapacityAnalysis2 = basicVolumeMapper.getOneByName("总硬度（样品体积mL）").toString();
        String volumeCapacityAnalysis3 = basicVolumeMapper.getOneByName("氯化物（样品体积mL）").toString();
        String volumeCapacityAnalysis4 = basicVolumeMapper.getOneByName("总碱度（样品体积mL）").toString();
        recordCapacityAnalysis.setVolume("{\"volume1\":" + volumeCapacityAnalysis1 + ",\"volume2\":" + volumeCapacityAnalysis2 + ",\"volume3\":" + volumeCapacityAnalysis3 + ",\"volume4\":" + volumeCapacityAnalysis4 + "}");
        recordCapacityAnalysis.setPermanganate("{\"oneFactory\":{\"titrationStart\":\"\",\"titrationEnd\":\"\",\"actualTitration\":\"\",\"sampleConcentration\":\"\",\"tip\":\"\"},\"twoFactory\":{\"titrationStart\":\"\"," +
                "\"titrationEnd\":\"\",\"actualTitration\":\"\",\"sampleConcentration\":\"\",\"tip\":\"\"},\"sourceWater\":{\"titrationStart\":\"\",\"titrationEnd\":\"\",\"actualTitration\":\"\",\"sampleConcentration\":\"\"," +
                "\"tip\":\"\"},\"kValue\":{\"titrationStart\":\"\",\"titrationEnd\":\"\",\"actualTitration\":\"\",\"sampleConcentration\":\"\",\"tip\":\"\"}}");
        recordCapacityAnalysis.setHardness("{\"blank\":{\"titrationStart\":\"\",\"titrationEnd\":\"\",\"actualTitration\":\"\",\"sampleConcentration\":\"\",\"tip\":\"\"},\"oneFactory\":{\"titrationStart\":\"\"," +
                "\"titrationEnd\":\"\",\"actualTitration\":\"\",\"sampleConcentration\":\"\",\"tip\":\"\"},\"twoFactory\":{\"titrationStart\":\"\",\"titrationEnd\":\"\",\"actualTitration\":\"\",\"sampleConcentration\":\"\"," +
                "\"tip\":\"\"},\"sourceWater\":{\"titrationStart\":\"\",\"titrationEnd\":\"\",\"actualTitration\":\"\",\"sampleConcentration\":\"\",\"tip\":\"\"}}");
        recordCapacityAnalysis.setChloride("{\"blank\":{\"titrationStart\":\"\",\"titrationEnd\":\"\",\"actualTitration\":\"\",\"sampleConcentration\":\"\",\"tip\":\"\"},\"oneFactory\":{\"titrationStart\":\"\"," +
                "\"titrationEnd\":\"\",\"actualTitration\":\"\",\"sampleConcentration\":\"\",\"tip\":\"\"},\"twoFactory\":{\"titrationStart\":\"\",\"titrationEnd\":\"\",\"actualTitration\":\"\",\"sampleConcentration\":\"\"," +
                "\"tip\":\"\"},\"sourceWater\":{\"titrationStart\":\"\",\"titrationEnd\":\"\",\"actualTitration\":\"\",\"sampleConcentration\":\"\",\"tip\":\"\"}}");
        recordCapacityAnalysis.setAlkalinity("{\"oneFactory\":{\"titrationStart\":\"\",\"titrationEnd\":\"\",\"actualTitration\":\"\",\"sampleConcentration\":\"\",\"tip\":\"\"},\"twoFactory\":{\"titrationStart\":\"\"," +
                "\"titrationEnd\":\"\",\"actualTitration\":\"\",\"sampleConcentration\":\"\",\"tip\":\"\"},\"sourceWater\":{\"titrationStart\":\"\",\"titrationEnd\":\"\",\"actualTitration\":\"\",\"sampleConcentration\":\"\"," +
                "\"tip\":\"\"}}");
        recordCapacityAnalysis.setStatus(1);
        recordCapacityAnalysisService.save(recordCapacityAnalysis);

        /*
          记录——分光光度法检测铝、铁、氨、亚硝酸盐原始记录 定时添加(默认数据（基础表：{查询列：查询数据}）id:随机数，form：{name："分光光度法检测铝、铁、氨、亚硝酸盐原始记录"}，device：{type："Lambda365"}，water:{id:"1695181972982825"},volume:[{name:"分光项目（样品体积mL-V(Al) / V其他）"}]
              restriction{restriction1:{name:"铝"},restriction2:{name:"铁"},restriction3:{name:"氨"},restriction4:{name:"亚硝酸盐"},restriction5:{name:"限值依据"}}，drug{drug1:{name:"铝"},drug2:{name:"铁"},drug3:{name:"氨"},drug4:{name:"亚硝酸盐"}}，
              curve{curve1:{name:"铝"},curve2:{name:"铁"},curve3:{name:"氨"},curve4:{name:"亚硝酸盐"}}，formula{formula1:{name:"铝"},formula2:{name:"铁"},formula3:{name:"氨"},formula4:{name:"亚硝酸盐"}}，
              curvePreparation{curvePreparation1:{name:"铝"},curvePreparation2:{name:"铁"},curvePreparation3:{name:"氨"},curvePreparation4:{name:"亚硝酸盐"}},
              preparation_check_value："{}"，water_check_value："{}"，status=1(未完成))
         */
        RecordSpectrophotometric recordSpectrophotometric = new RecordSpectrophotometric();
        recordSpectrophotometric.setId(RandomIdUtil.createRandomId());
        recordSpectrophotometric.setForm((basicFormMapper.getOneByName("分光光度法检测铝、铁、氨、亚硝酸盐原始记录")).toString());
        recordSpectrophotometric.setDevice((basicDeviceMapper.getOneByName("Lambda365")).toString());
        recordSpectrophotometric.setWater((basicWaterMapper.getOneByName("1695181972982825")).toString());
        recordSpectrophotometric.setVolume((basicVolumeMapper.listOneByName("分光项目（样品体积mL-V(Al) / V其他）")).toString());
        String restrictionSpectrophotometric1 = basicRestrictionMapper.getOneByName("铝").toString();
        String restrictionSpectrophotometric2 = basicRestrictionMapper.getOneByName("铁").toString();
        String restrictionSpectrophotometric3 = basicRestrictionMapper.getOneByName("氨").toString();
        String restrictionSpectrophotometric4 = basicRestrictionMapper.getOneByName("亚硝酸盐").toString();
        String restrictionSpectrophotometric5 = basicRestrictionMapper.getOneByName("限值依据").toString();
        recordSpectrophotometric.setRestriction("{\"restriction1\":" + restrictionSpectrophotometric1 + ",\"restriction2\":" + restrictionSpectrophotometric2 + ",\"restriction3\":" + restrictionSpectrophotometric3 + ",\"restriction4\":" + restrictionSpectrophotometric4 + ",\"restriction5\":" + restrictionSpectrophotometric5 + "}");
        String drugSpectrophotometric1 = basicDrugMapper.listByName("铝").toString();
        String drugSpectrophotometric2 = basicDrugMapper.listByName("铁").toString();
        String drugSpectrophotometric3 = basicDrugMapper.listByName("氨").toString();
        String drugSpectrophotometric4 = basicDrugMapper.listByName("亚硝酸盐").toString();
        recordSpectrophotometric.setDrug("{\"drug1\":" + drugSpectrophotometric1 + ",\"drug2\":" + drugSpectrophotometric2 + ",\"drug3\":" + drugSpectrophotometric3 + ",\"drug4\":" + drugSpectrophotometric4 + "}");
        String formulaSpectrophotometric1 = basicFormulaMapper.getOneByName("铝").toString();
        String formulaSpectrophotometric2 = basicFormulaMapper.getOneByName("铁").toString();
        String formulaSpectrophotometric3 = basicFormulaMapper.getOneByName("氨").toString();
        String formulaSpectrophotometric4 = basicFormulaMapper.getOneByName("亚硝酸盐").toString();
        recordSpectrophotometric.setFormula("{\"formula1\":" + formulaSpectrophotometric1 + ",\"formula2\":" + formulaSpectrophotometric2 + ",\"formula3\":" + formulaSpectrophotometric3 + ",\"formula4\":" + formulaSpectrophotometric4 + "}");
        String curveSpectrophotometric1 = basicCurveMapper.getOneByName("铝").toString();
        String curveSpectrophotometric2 = basicCurveMapper.getOneByName("铁").toString();
        String curveSpectrophotometric3 = basicCurveMapper.getOneByName("氨").toString();
        String curveSpectrophotometric4 = basicCurveMapper.getOneByName("亚硝酸盐").toString();
        recordSpectrophotometric.setCurve("{\"curve1\":" + curveSpectrophotometric1 + ",\"curve2\":" + curveSpectrophotometric2 + ",\"curve3\":" + curveSpectrophotometric3 + ",\"curve4\":" + curveSpectrophotometric4 + "}");
        String curvePreparationSpectrophotometric1 = basicCurvePreparationMapper.getOneByName("铝").toString();
        String curvePreparationSpectrophotometric2 = basicCurvePreparationMapper.getOneByName("铁").toString();
        String curvePreparationSpectrophotometric3 = basicCurvePreparationMapper.getOneByName("氨").toString();
        String curvePreparationSpectrophotometric4 = basicCurvePreparationMapper.getOneByName("亚硝酸盐").toString();
        recordSpectrophotometric.setCurvePreparation("{\"curvePreparation1\":" + curvePreparationSpectrophotometric1 + ",\"curvePreparation2\":" + curvePreparationSpectrophotometric2 + ",\"curvePreparation3\":" + curvePreparationSpectrophotometric3 + ",\"curvePreparation4\":" + curvePreparationSpectrophotometric4 + "}");
        recordSpectrophotometric.setPreparationCheckValue("{\"aluminium\":{\"detectionValue\":\"\",\"relativeError\":\"\"},\"iron\":{\"detectionValue\":\"\",\"relativeError\":\"\"},\"ammonia\":{\"detectionValue\":\"\"," +
                "\"relativeError\":\"\"},\"nitrite\":{\"detectionValue\":\"\",\"relativeError\":\"\"}}");
        recordSpectrophotometric.setWaterCheckValue("{\"blank\":{\"al\":\"\",\"fe\":\"\",\"nh3\":\"\",\"freeAmmonia\":\"\",\"no2\":\"\",\"tip\":\"\"},\"sourceWater\":{\"al\":\"\",\"fe\":\"\",\"nh3\":\"\"," +
                "\"freeAmmonia\":\"\",\"no2\":\"\",\"tip\":\"\"},\"oneFactory\":{\"al\":\"\",\"fe\":\"\",\"nh3\":\"\",\"freeAmmonia\":\"\",\"no2\":\"\",\"tip\":\"\"},\"twoFactory\":{\"al\":\"\",\"fe\":\"\",\"nh3\":\"\"," +
                "\"freeAmmonia\":\"\",\"no2\":\"\",\"tip\":\"\"}}");
        recordSpectrophotometric.setStatus(1);
        recordSpectrophotometricService.save(recordSpectrophotometric);
    }
}
